package com.dhcc.wb.qiye;

import java.util.List;

import com.dhcc.bussiness.page.PageBean;

public class QiyeService {
	
	public PageBean<QiyeModel> findQiyeServiceByPage(int currentPage, int currentCount,String name) {
		QiyeDao dao = new QiyeDao();
		PageBean<QiyeModel> pageBean = new PageBean<QiyeModel>();
		try {
			pageBean.setCurrentPage(currentPage);
			pageBean.setCurrentCount(currentCount);
			Integer totalCount = dao.queryCount(name);
			pageBean.setTotalCount(totalCount);
			int totalPage = (int) Math.ceil(1.0*totalCount/currentCount);
			pageBean.setTotalPage(totalPage);
			int startIndex = (currentPage-1)*currentCount;
//			List<QiyeModel> pageList = dao.findSh_logServiceByPage(startIndex,currentCount,name,xiala);
			List<QiyeModel> pageList = dao.findQiyeServiceByPage(startIndex, currentCount, name);
			pageBean.setPageList(pageList);
		}catch (Exception e) {
			e.printStackTrace();
		}
		return pageBean;
	}
}